package com.myspace.controller.post;

import com.myspace.service.space.post.UpdatePostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class UpdatePostController {

    @Autowired
    private UpdatePostService updatePostService;

    @PostMapping("/myspace/updatepost/")
    public Map<String, String> updatepost(@RequestParam Map<String, String> data) {
        Integer postId = Integer.parseInt(data.get("post_id"));
        String content = data.get("content");

        return updatePostService.updatepost(postId, content);

    }
}
